package com.wjqy.entity;


public class CommonReturnEntity {

    public CommonReturnEntity(String status, Object data) {
        this.status = status;
        this.data = data;
    }

    // 表明某个请求处理结果 success / fail
    private String status;
    // 若 status 是success ,data 保存要返回的json数据
    // 若 status 是fail, data 保存 通用错误结果返回格式（错误码及错误信息）
    private Object data;

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    // 如果只传数据，默认响应结果为 success
    public static CommonReturnEntity success(Object data){
        return new CommonReturnEntity("success", data);
    }

    public static CommonReturnEntity fail(Object data) {
        return new CommonReturnEntity("fail", data);
    }
    
}
